﻿using Cofe.Core.Implements;
using Cofe.Core.Interfaces;
using Cofe.Core.Security;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace Cofe.Core.Session
{
    [CollectionDataContract]
    public class VolumeInfoList : List<IVolumeInfo>
    {
        public VolumeInfoList(IEnumerable<IVolumeInfo> collection) : base(collection) { }
        public VolumeInfoList() : base() { }
    }
    [CollectionDataContract]
    public class UserPolicyList : List<IPrincipalPolicy>
    {
        public UserPolicyList(IEnumerable<IPrincipalPolicy> collection) : base(collection) { }
        public UserPolicyList() : base() { }
    }
    [CollectionDataContract]
    public class PermissionList : List<IPermissionPolicy>
    {
        public PermissionList(IEnumerable<IPermissionPolicy> collection) : base(collection) { }
        public PermissionList() : base() { }
    }


    public interface ICofeSettings : ICofeService
    {
        UserPolicyList UserPermissions { get; set; }
        VolumeInfoList Volumes { get; set; }
        PermissionList Permissions { get; set; }        

        TimeSpan EventBufferTime { get; set; }
        TimeSpan CacheExpireTime { get; set; }
        TimeSpan ListExpireTime { get; set; }        

        CacheUpdateOptions CacheUpdateOptions { get; set; }

        /// <summary>
        /// Use CofeServices.SaveAsync().
        /// </summary>
        /// <returns></returns>
        Task SaveAsync();

        /// <summary>
        /// Use CofeServices.RestoreAsync().
        /// </summary>
        /// <returns></returns>
        Task RestoreAsync();

        IEnumerable<IPermissionPolicy<T>> GetPermissionPolicies<T>() where T : IProtectedData<T>;

    }
}
